home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / rendermap.scm < prev    next >
Encoding:
Text File  |  2009-08-19  |  3.3 KB  |  95 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  
  17.  
  18. (define (script-fu-render-map inSize
  19.                               inGrain
  20.                               inGrad
  21.                               inWiden)
  22.  
  23.   (let* (
  24.         (theWidth inSize)
  25.         (theHeight inSize)
  26.         (theImage (car(gimp-image-new theWidth theHeight RGB)))
  27.         (theLayer 0)
  28.         (thinLayer 0)
  29.         )
  30.  
  31.   (gimp-context-push)
  32.  
  33.   (gimp-selection-all theImage)
  34.  
  35.   (set! theLayer (car (gimp-layer-new theImage theWidth theHeight
  36.                                       RGBA-IMAGE
  37.                                       "I've got more rubber ducks than you!"
  38.                                       100 NORMAL-MODE)))
  39.   (gimp-image-add-layer theImage theLayer 0)
  40.   (plug-in-solid-noise RUN-NONINTERACTIVE
  41.                theImage theLayer 1 0 (rand 65536)
  42.                        inGrain inGrain inGrain)
  43.  
  44.   (if (= inWiden 1)
  45.       (begin
  46.         (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
  47.                                              RGBA-IMAGE "Camo Thin Layer"
  48.                                              100 NORMAL-MODE)))
  49.         (gimp-image-add-layer theImage thinLayer 0)
  50.  
  51.         (let ((theBigGrain (min 15 (* 2 inGrain))))
  52.           (plug-in-solid-noise RUN-NONINTERACTIVE
  53.                    theImage thinLayer 1 0 (rand 65536)
  54.                                theBigGrain theBigGrain theBigGrain))
  55.  
  56.         (gimp-context-set-background '(255 255 255))
  57.         (gimp-context-set-foreground '(0 0 0))
  58.  
  59.         (let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
  60.           (gimp-layer-add-mask thinLayer theMask)
  61.  
  62.           (gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE
  63.                            GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE
  64.                            FALSE 0 0 TRUE
  65.                            0 0 0 (/ theHeight 2)))
  66.  
  67.         (set! theLayer (car(gimp-image-flatten theImage)))))
  68.  
  69.   (gimp-selection-none theImage)
  70.   (gimp-context-set-gradient inGrad)
  71.   (plug-in-gradmap RUN-NONINTERACTIVE theImage theLayer)
  72.  
  73.   (gimp-display-new theImage)
  74.  
  75.   (gimp-context-pop)
  76.   )
  77. )
  78.  
  79. (script-fu-register "script-fu-render-map"
  80.   _"Render _Map..."
  81.   _"Create an image filled with an Earth-like map pattern"
  82.   "Chris Gutteridge: cjg@ecs.soton.ac.uk"
  83.   "28th April 1998"
  84.   "Chris Gutteridge / ECS @ University of Southampton, England"
  85.   ""
  86.   SF-ADJUSTMENT _"Image size"       '(256 0 2048 1 10 0 0)
  87.   SF-ADJUSTMENT _"Granularity"      '(4 0 15 1 1 0 0)
  88.   SF-GRADIENT   _"Gradient"         "Land and Sea"
  89.   SF-TOGGLE     _"Gradient reverse" FALSE
  90.   SF-OPTION     _"Behavior"         '(_"Tile" _"Detail in Middle")
  91. )
  92.  
  93. (script-fu-menu-register "script-fu-render-map"
  94.                          "<Image>/File/Create/Patterns")
  95.